/**
 * @Author: Lenovo
 * @Date: 2024/11/7 19:53
 * @description:
 */
public class Demo08 {
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            while (true){
                System.out.println("全家人一直在吃");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });
        Thread t2 = new Thread(()->{
           for (int i = 0;i<3;i++){
               System.out.println("我也在吃，但是吃完饭就要结束这个线程");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        });
        //t1.setDaemon(true);
        t1.start();
        t2.start();
    }
}
